extends Area2D

@onready var output: Label = get_node("/root/main/output")
@onready var hitbox: CollisionShape2D = get_node("hitbox")

func _ready():
	connect("area_entered", update_score)

func update_score(_area):
	if Global.player_dead:
		return
	output.text = str(int(output.text) + 1)
	hide()
	call_deferred("disable_hitbox")

func disable_hitbox():
	hitbox.disabled = true

func enable_hitbox():
	hitbox.disabled = false
